//
// RemoteResource.h
// Usage: Resource provided by user process 
// Create Date: 2009-04-28
// Author: MaJiuyue
//
#ifndef _REMOTE_RESOURCE_H_
#define _REMOTE_RESOURCE_H_

#include <type.h>
#include <Map.h>

/* RemoteResource Object */
class RemoteResource
{
public:
	/* Construct remote resource */
	RemoteResource(addr_t target)
	/* Destory remote resource */
	~RemoteResource();

public:
	/*
	    Usage: Register a service interface 
	    Parameters:
	        entry	-	Service call interface entry address 
	        SCIID	-	Service call interface ID
	*/
	bool RegisterInterface(addr_t entry, u32 SCIID);

	/*
	    Usage: Remove a service interface
	    Parameters:
	        SCIID	-	Service call interface ID
	*/
	void RemoveInterface(u32 SCIID);

	u32 CallSCI(u32 SCIID, u32 p1=0, u32 p2=0, u32 p3=0, u32 p4=0, u32 p5=0);

private:
	/* Resource ID allocated by ResourceManager */
	int m_iResourceID;
	
	/* Resource service call target */
	addr_t m_target;

	/* Service Interface Map */
	Map<u32, addr_t, 5> SCIT0;
	Map<u32, addr_t, 5> SCIT1;
	Map<u32, addr_t, 5> SCIT2;
	Map<u32, addr_t, 5> SCIT3;
	Map<u32, addr_t, 5> SCIT4;
	Map<u32, addr_t, 5> SCIT5;
};

#endif
